<<<<<<< HEAD
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include"main.h"
int main()
{
    sqstack * L;
    L=list_init(10);
    list_push(L,10);
    list_push(L,20);
    list_push(L,22);
    list_push(L,40);
    list_pop(L);

}

sqstack * list_init(int len)
{
    sqstack * H;
    if((H=(sqstack *)malloc(sizeof(sqstack)))==NULL)                        //动态内存的分配
        return NULL;
    if((H->data=(data_t *)malloc(len*sizeof(data_t)))==NULL)
        return NULL;
    
    memset(H->data,0,sizeof(data_t)*len);

    H->last=-1;
    H->maxlen=len;
    return H;
}

int list_push(sqstack *H,data_t value)
{
    if(H==NULL)
    {
        printf("list is NULL\n");
        return -1;
    }

    H->last++;
    H->data[H->last]=value;
    return 0;
}

int list_pop(sqstack* H)
{
    while(H->last+1)
    {
        printf("%d\n",H->data[H->last]);
        H->last--;
    }
    return 0;
}

=======
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include"main.h"
int main()
{
    sqstack * L;
    L=list_init(10);
    list_push(L,10);
    list_push(L,20);
    list_push(L,22);
    list_push(L,40);
    list_pop(L);

}

sqstack * list_init(int len)
{
    sqstack * H;
    if((H=(sqstack *)malloc(sizeof(sqstack)))==NULL)                        //动态内存的分配
        return NULL;
    if((H->data=(data_t *)malloc(len*sizeof(data_t)))==NULL)
        return NULL;
    
    memset(H->data,0,sizeof(data_t)*len);

    H->last=-1;
    H->maxlen=len;
    return H;
}

int list_push(sqstack *H,data_t value)
{
    if(H==NULL)
    {
        printf("list is NULL\n");
        return -1;
    }

    H->last++;
    H->data[H->last]=value;
    return 0;
}

int list_pop(sqstack* H)
{
    while(H->last+1)
    {
        printf("%d\n",H->data[H->last]);
        H->last--;
    }
    return 0;
}

>>>>>>> aba5ded75987e60f486da6f8a79460a036347bf0
